﻿using IntelligentGateway.Tools;
using Microsoft.Extensions.Configuration;
using MySql.Data.MySqlClient;
using System;
using System.Data;

namespace IntelligentGateway.Data
{
    public class DataFactory
    {
        private static string MYSQLCONNSTR = AppSettingsTools.GetContent("ConnectionStrings", "MySqlConnection");
        public static IDbConnection GetMYSQLConnection()
        {
          
            IDbConnection connection;
            if (string.IsNullOrEmpty(MYSQLCONNSTR))
            { 
                return null;               
            }
            else
            {
                connection = new MySqlConnection(MYSQLCONNSTR);
                return connection;
            }            
        }
    }
}
